home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 4 #3 / Commodore_Disk_User_Vol.4_3_1991_-.d64 / aw-basic parser (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  1KB  |  51 lines

  1. 5 rem"[141][154]
  2. 100 [143] ********************************
  3. 110 [143] *   very simple basic parser   *
  4. 120 [143] *        by jason finch        *
  5. 130 [143] *                              *
  6. 140 [143] * enter command and it will be *
  7. 150 [143] * split (verb-noun form only.) *
  8. 160 [143] *                              *
  9. 170 [143] * check data at end for vocab. *
  10. 180 [143] ********************************
  11. 190 [141]500:[133]"loadprintwhat now";comm$:[143]"gosub
  12. 200 noun$="": verb$="": vb=0: no=0
  13. 210 l=len(comm$)
  14. 220 for x=1 to l
  15. 230 if mid$(comm$,x,1)=" " then x=l: goto 250
  16. 240 verb$=verb$+mid$(comm$,x,1)
  17. 250 next
  18. 260 v$=verb$:verb$=left$(v$,4)
  19. 270 f=0: for x=1 to nv
  20. 280 if verb$=vb$(x) then vb=x: f=1: x=nv
  21. 290 next: if f=1 then 320
  22. 300 vb=0: if v$=comm$ then 340
  23. 310 goto 330
  24. 320 if(len(v$)+1) >= len(comm$) then noun=0: goto 420
  25. 330 noun$=right$(comm$,l-1-len(v$))
  26. 340 n$=noun$:noun$=left$(n$,4)
  27. 350 f=0: for x=1 to nn
  28. 360 if no$(x)=noun$ then no=x: f=1:x=nn
  29. 370 next: if f=1 then 390
  30. 380 no=0: goto 420
  31. 390 goto 420:rem"[141][154]
  32. 400 :
  33. 410 :
  34. 420 [153] "sys verb: open"v$
  35. 430 [153] "sys noun: open"n$
  36. 440 [153]
  37. 450 [153] "sys verb number:open"vb
  38. 460 [153] "sys noun number:open"no
  39. 470 [153]:[153]:[153]"":[128]
  40. 480 :
  41. 490 :
  42. 500 [151]53280,5:[151]53281,11
  43. 510 nv[178]6: nn[178]4
  44. 520 [129] x[178]1 [164] nv: [135] vb$(x): [130]
  45. 530 [129] x[178]1 [164] nn: [135] no$(x): [130]
  46. 540 [142]
  47. 550 :
  48. 560 :
  49. 570 [131] get,drop,sear,look,eat,hit
  50. 580 [131] coin,key,door,appl
  51.